using System;

namespace Admin.Net.Plugin.Api;

public class ElectricityConsumptionRatioDto
{
	public decimal TipValue { get; set; }

	/// <summary>
	/// 峰
	/// </summary>
	public decimal PeakValue { get; set; }

	/// <summary>
	/// 平
	/// </summary>
	public decimal FlatValue { get; set; }

	/// <summary>
	/// 谷
	/// </summary>
	public decimal ValleyValue { get; set; }

	/// <summary>
	/// 总
	/// </summary>
	public decimal TotalValue { get; set; }

	public string TipValueRate
	{
		get
		{
			if (TotalValue == 0m)
			{
				return "0.00%";
			}
			return Math.Round(Math.Round(TipValue / TotalValue, 4) * 100m, 2) + "%";
		}
	}

	/// <summary>
	/// 峰
	/// </summary>
	public string PeakValueRate
	{
		get
		{
			if (TotalValue == 0m)
			{
				return "0.00%";
			}
			return Math.Round(Math.Round(PeakValue / TotalValue, 4) * 100m, 2) + "%";
		}
	}

	/// <summary>
	/// 平
	/// </summary>
	public string FlatValueRate
	{
		get
		{
			if (TotalValue == 0m)
			{
				return "0.00%";
			}
			return Math.Round(Math.Round(FlatValue / TotalValue, 4) * 100m, 2) + "%";
		}
	}

	/// <summary>
	/// 谷
	/// </summary>
	public string ValleyValueRate
	{
		get
		{
			if (TotalValue == 0m)
			{
				return "0.00%";
			}
			return Math.Round(Math.Round(ValleyValue / TotalValue, 4) * 100m, 2) + "%";
		}
	}
}
